#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QIcon>
#include "httputils.h"
#include "serivce.h"

int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

    QGuiApplication app(argc, argv);

    //设置logo
    app.setWindowIcon(QIcon(":/images/logo.png"));

    QQmlApplicationEngine engine;
    qmlRegisterType<HttpUtils>("Http",1,0,"HttpUtils");
    qmlRegisterType<Serivce>("Serivce",1,0,"Servce");
    const QUrl url(QStringLiteral("qrc:/App.qml"));

    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
        &app, [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl)
                QCoreApplication::exit(-1);
        }, Qt::QueuedConnection);
    engine.load(url);


    return app.exec();
}
